import React, { Component } from 'react'

import { Route, Switch } from 'react-router-dom'

// 导入路由规则匹配成功后要渲染的组件
import Home from './views/Home'
import About from './views/About'
import News from './views/News'
import Detail from './views/Detail'

class App extends Component {
  render() {
    return (
      <div>
        <Switch>
          <Route path="/news" component={News} />
          {/* 动态路由参数 */}
          <Route path="/detail/:id" component={Detail} />
          <Route path="/about" component={About} />
          <Route path="/" component={Home} />
        </Switch>
      </div>
    )
  }
}

export default App
